package com.hiwhitley.easy.day26;

/**
 * Created by hiwhitley on 2016/10/25.
 */
public class MissingNumber_268 {
    public int missingNumber(int[] nums) {
        if (nums == null)
            return -1;
        int sum1 = nums.length;
        int sum2 = 0;
        for (int i = 0; i < nums.length; i++) {
            sum1 += i;
            sum2 += nums[i];
        }
        return sum1 - sum2;
    }

    public static void main(String[] args) {
        MissingNumber_268 main = new MissingNumber_268();
        System.out.println(main.missingNumber(new int[]{0, 1, 2, 3, 4, 5, 7}));
    }
}
